package com.pzhu.user.domain.enums;

import com.fasterxml.jackson.annotation.JsonValue;
import com.mybatisflex.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 权限状态
 *
 * @author 75073
 * @date 2024/07/10
 */
@AllArgsConstructor
@Getter
public enum PermissionStatus {
    DIS_ABLE(0, "禁用"),
    NORMAL(1, "正常"),
    ;
    /** 代码 */
    @EnumValue
    @JsonValue
    private final Integer code;

    /** 描述 */
    private final String description;

    public static PermissionStatus of(Integer code) {
        if (code == null) {
            return null;
        }
        for (PermissionStatus status : PermissionStatus.values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }
}
